package com.springboot.blog.controller;

import com.springboot.blog.entity.Nav;
import com.springboot.blog.service.NavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class IndexController {
    @Resource
    private NavService nav;
    @GetMapping("/")
    public String index(Model m) {
        List<Nav> navs = nav.selectAll();
        m.addAttribute("navs",navs);
        return "index";
    }
}
